home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-24 | 3.5 KB | 121 lines | [TEXT/MMCC] |
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // Portions copyright © 1995 Mark D. Gerl. All rights reserved worldwide.
- //
- // Project: ProcessBar™
- //
- // File: mdg.h
- //
- // Description: Most of the code written to extend Matt Slot's appe Windows into what it is
- //
- // Written by: Mark D. Gerl
- //
- // Disclaimer: Written over 40 hours at MacHack '95 -- use at your own risk (actually, I think
- // this code is REALLY stable)!
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
- #if !defined(__MDG__)
- #define __MDG__
-
-
- #include <Types.h>
- #include <Files.h>
- #include <Processes.h>
- #include <AppleEvents.h>
-
- #define kStandardIconSize 32
- #define kTaskbarButtonFrameWidth 2
- #define kTaskbarButtonBorderSize 4
- #define kTaskbarTopMargin 4
- #define kTaskbarLeftMargin 6
- #define kTaskbarBetweenMargin 6
- #define kTaskbarScreenBottomMargin 4
- #define kTaskbarHeight (kStandardIconSize + (kTaskbarTopMargin << 1))
-
- #define kMaxProcesses 25
-
- #define kTaskbarFont applFont
- #define kTaskbarFontSize 12
- #define kTaskbarFontStyle bold
-
- #define kTaskbarBgColor 0xbbbb
- #define kLtGrayColorValue 0xeeee
- #define kDkGrayColorValue 0x8000
-
- #define kMacOSIconRsrcID 130
-
- typedef enum
- {
- kFrameInset,
- kFrameOutset
- } FrameType;
-
- typedef struct
- {
- ProcessSerialNumber psn;
- Rect buttonRect;
- Handle iconSuite;
- Boolean iconIsHilited;
-
- } PSNRec, *PSNRecPtr, **PSNRecHdl;
-
- extern const RGBColor kBgGrayColor;
- extern const RGBColor kLtGrayColor;
- extern const RGBColor kDkGrayColor;
-
- extern WindowPtr gTaskbarWindow;
- extern Boolean gTaskbarVisible;
-
- // Prototypes of code written by Mark D. Gerl
-
- void SetupOffscreenWorld(void);
- void UpdateFromOffscreenWorld(Rect *r);
-
- void Draw3DFrame(Rect * r, FrameType ft);
- void ShowTaskbar(WindowPtr win);
- void HideTaskbar(WindowPtr win);
- void ToggleTaskbarVisibility(WindowPtr win);
- Boolean FindFirstVisibleProcess(ProcessSerialNumber *psn);
- void TogglePSNVisibility(ProcessSerialNumber *psn);
- void BringPSNToFront(ProcessSerialNumber *psn);
- void Remove1TaskbarProcess(short processArrayIndex);
- void RemovePSNFromProcessArray(ProcessSerialNumber *psn);
- Boolean FindPSNInProcessArray(ProcessSerialNumber *psn, short *processArrayIndex);
- Boolean FindPSNForClick(Point where, ProcessSerialNumber *psn, short *processArrayIndex);
- Boolean IsProcessAlive(ProcessSerialNumber *psn);
- void UpdateProcessArray(void);
- void AdjustIcons(void);
- void HiliteCurrentProcess(void);
- void IdleTaskbar(void);
- void DoMacOSIconClick(EventRecord *theEvent);
- Boolean TrackTaskbarButtonClick(EventRecord *theEvent, Rect *box);
- void DoClickInTaskbar(EventRecord *theEvent, WindowPtr win);
- void AddProcessToTaskbar(ProcessSerialNumber *psn);
- void DrawMacOSIcon();
- void Draw1TaskbarProcess(short processArrayIndex);
- void DrawTaskbar(WindowPtr win);
-
- // The following code was nabbed from MacApp
-
- void PullApplicationToFront();
- static Boolean IsThisKeyDown(const short theKey);
- Boolean IsCommandKeyDown();
- Boolean IsControlKeyDown();
- Boolean IsOptionKeyDown();
- Boolean IsShiftKeyDown();
-
- // Borrowed from DropShell 2.0 sources (thanks Leonard!)...
-
- void GetMyAppName(Str255 appName);
- void GetAppFSSpec(FSSpec *appSpec);
- OSErr GetTargetFromSelf (AEAddressDesc *targetDesc);
- OSErr GetTargetFromSignature (OSType processSig, AEAddressDesc *targetDesc);
- void SendQuitToSelf (void);
- void SendQuitToPSN (ProcessSerialNumber *psn); // based on SendQuitToSelf()
- void SendRestartToFinder();
- void SendShutDownToFinder();
-
-
- #endif